package com.hnkywl.sts.action.cwgl.kmys;

import com.hnkywl.sts.entity.sys.Yg;
import com.hnkywl.sts.service.sys.YgService;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created with IntelliJ IDEA.
 * User: ccr
 * Date: 13-5-15
 * Time: 下午4:37
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/cwgl/kmys/ygkmdmys")
public class YgkmdmysAction extends SimpleActionSupport{
    private YgService ygService;
    //查询条件： 主管机构
    private Long zgjgId;
    //查询条件：姓名
    private String xm;
    //分页组件 起始位置
    private int page;
    //分页组件 页面大小
    private int rows = 10;
    //员工实体
    private Yg yg;

    @Action("ygkmdmysList")
    public void ygkmdmysList(){
        renderJson(ygService.findKmdm(zgjgId,xm,page,rows));
    }

    @Action("save_ygkmdmys")
    public void save(){
        try{
            ygService.saveYgkmdmys(yg);
            renderJson("{\"statusCode\":200}");
        }catch (Exception  e) {
            e.printStackTrace();
            renderJson("{\"statusCode\":300,\"message\":\""+e.getMessage()+"\"}");
        }
    }

    public Long getZgjgId() {
        return zgjgId;
    }

    public void setZgjgId(Long zgjgId) {
        this.zgjgId = zgjgId;
    }

    public String getXm() {
        return xm;
    }

    public void setXm(String xm) {
        this.xm = xm;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    public Yg getYg() {
        return yg;
    }

    public void setYg(Yg yg) {
        this.yg = yg;
    }

    @Autowired
    public void setYgService(YgService ygService) {
        this.ygService = ygService;
    }
}
